home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 099 (1989-05-15)(Ossowski, Stefan)(DE)(PD).zip / Taifun 099 (1989-05-15)(Ossowski, Stefan)(DE)(PD).adf / PCQ / Runtime / readonechar.asm < prev    next >
Assembly Source File  |  1989-03-31  |  700b  |  40 lines

  1.  
  2. *    ReadOneChar.asm (of PCQ Pascal runtime library)
  3. *    Copyright (c) 1989 Patrick Quaid
  4.  
  5. *    This module implements a simple buffering scheme for
  6. *    standard in.  We don't always buffer a character- we only buffer
  7. *    one when we have read one too many.
  8.  
  9.     SECTION    ONE
  10.  
  11.     XREF    stdinbuffed
  12.     XREF    stdinbuffer
  13.     XREF    _stdin
  14.     XREF    _p%DOSBase
  15.     XREF    _LVORead
  16.  
  17.     XDEF    _p%readonechar
  18. _p%readonechar
  19.     tst.b    stdinbuffed
  20.     beq.s    1$
  21.     move.b    #0,stdinbuffed
  22.     rts
  23. 1$    movem.l    d1-d3,-(sp)
  24.     move.l    _stdin,d1
  25.     move.l    #stdinbuffer,d2
  26.     move.l    #1,d3
  27.     move.l    _p%DOSBase,a6
  28.     jsr    _LVORead(a6)
  29.     move.b    #-1,stdinbuffed
  30.     movem.l    (sp)+,d1-d3
  31.     rts
  32.  
  33.     XDEF    _p%getthatchar
  34. _p%getthatchar
  35.     move.b    stdinbuffer,d0
  36.     move.b    #0,stdinbuffed
  37.     rts
  38.  
  39.     END
  40.